package DBUnitTests;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import org.junit.Test;

import junit.framework.Assert;
import junit.framework.TestCase;

import dataBase.ISqlTable;
import dataBase.SqlTable;

public class TableUnitTest extends TestCase {
	final static String driver = "com.mysql.jdbc.Driver";
	Connection con = null;
	Statement stmt = null;
	ISqlTable sqlTable = null;
	Map<String, String> myMap = null;
	
	protected void setUp() throws Exception {
		String url = "jdbc:mysql://localhost:3306/";
		// Load the Driver class. 
		Class.forName(driver);
		con = DriverManager.getConnection (url+ "CodeSharingDB", "root", "skravi");
		stmt = con.createStatement();
		myMap = new HashMap<String, String>();
		myMap.put("try1", "int");
		
	}

	@Test
	public void testCreateTable() throws SQLException{
		sqlTable = new SqlTable(stmt, "users", myMap, "innodb");
		sqlTable.createTable();
		List<String> list = new LinkedList<String>();
		list.add("5");
		sqlTable.insertRecord(list);
	}
	
	@Test
	public void testList()
	{
		List<String> list = new LinkedList<String>();
		list.add("elad");
		list.add("yoni");
		
		Assert.assertTrue(true);
	}
}
